using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.ExpressApp.DC;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Xpo;
namespace Ascent.Module.BusinessObjects.Sales
{
  public partial class SaleOrderDetail : DevExpress.Persistent.BaseImpl.BaseObject
  {
    private Ascent.Module.BusinessObjects.Base.Product _product;
    private System.Single _totalAmount;
    private Ascent.Module.BusinessObjects.Sales.SaleOrder _saleOrder;
    private System.String _remarks;
    private System.Single _amount;
    private System.Single _discountAmount;
    private System.Single _discountPercent;
    private System.Single _quantity;
    private System.Single _unitPrice;
    public SaleOrderDetail(DevExpress.Xpo.Session session)
      : base(session)
    {
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("产品")]
    public Ascent.Module.BusinessObjects.Base.Product Product
    {
      get
      {
        return _product;
      }
      set
      {
        if (_product == value)
          return;
        Ascent.Module.BusinessObjects.Base.Product prevProduct = _product;
        _product = value;
        if (IsLoading)
          return;
        if (prevProduct != null && prevProduct.SaleOrderDetail == this)
          prevProduct.SaleOrderDetail = null;
        if (_product != null)
          _product.SaleOrderDetail = this;
        OnChanged("Product");
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("单价")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Single UnitPrice
    {
      get
      {
        return _unitPrice;
      }
      set
      {
        SetPropertyValue("UnitPrice", ref _unitPrice, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("数量")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Single Quantity
    {
      get
      {
        return _quantity;
      }
      set
      {
        SetPropertyValue("Quantity", ref _quantity, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("折扣%")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Single DiscountPercent
    {
      get
      {
        return _discountPercent;
      }
      set
      {
        SetPropertyValue("DiscountPercent", ref _discountPercent, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("备注")]
    public System.String Remarks
    {
      get
      {
        return _remarks;
      }
      set
      {
        SetPropertyValue("Remarks", ref _remarks, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("合计金额")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Single TotalAmount
    {
      get
      {
        return _totalAmount;
      }
      set
      {
        SetPropertyValue("TotalAmount", ref _totalAmount, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("折扣金额")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Single DiscountAmount
    {
      get
      {
        return _discountAmount;
      }
      set
      {
        SetPropertyValue("DiscountAmount", ref _discountAmount, value);
      }
    }
    [DevExpress.ExpressApp.DC.XafDisplayNameAttribute("实付金额")]
    [DevExpress.Persistent.Base.ImmediatePostDataAttribute]
    public System.Single Amount
    {
      get
      {
        return _amount;
      }
      set
      {
        SetPropertyValue("Amount", ref _amount, value);
      }
    }
    [DevExpress.Xpo.AssociationAttribute("SaleOrderDetails-SaleOrder")]
    [System.ComponentModel.BrowsableAttribute(false)]
    public Ascent.Module.BusinessObjects.Sales.SaleOrder SaleOrder
    {
      get
      {
        return _saleOrder;
      }
      set
      {
        SetPropertyValue("SaleOrder", ref _saleOrder, value);
      }
    }
  }
}
